{#include file="top.php"#}

<div class="body">

    <div class="main fl">
        <div class="crumb">
            <a href="{#optimize_url('events', 'invite_list')#}">活動事件</a> &gt;<a href="{#optimize_url('events', 'invite_list')#}">{#$event.cname#}</a> &gt;
            <strong>{#$event.title#}</strong>
        </div>

        <div class="eibox nobd b_box">
            <div class="hd">
                <h2 class="ir ht"><span>活動邀請 EVENT INVITATION</span></h2>
            </div>
            <div class="bd">
                <div {#if $event.member_type==5#}class="areabox pro"{#else#}class="areabox try" {#/if#}>
                    <h2 class="at">{#if $event.member_type==5#}尊業體驗團{#else#}試用專區{#/if#}</h2>
                    <div class="lbox">
						<div class="imgbox"><p class="img_p"><span><img src="{#$event._photo_url#}"></span></p></div>

<!--<div class="ir gf"><span>工作坊</span></div>-->
                        <div class="ir {#if $event.event_type==1#}gf{#else#}act{#/if#}"><span>{#$event.cname#}</span></div>
                    </div>
                    <div class="rbox">
                        <a href="http://service.weibo.com/share/share.php?url={#$thisUrl#}&title={#$event.name#}-{#$event.cname#}-申請試用&pic={#$global_url#}{#$event._photo_url#}" class="ir fb_icon"  target=_blank><span>facebook</span></a>
                        <a href="javascript:void(0);"  class="ir sina_icon" onclick="postToFeed()"><span>facebook</span></a>
                        <div class="tbox">
                            <table width="100%" border="0" cellpadding="0">
                                <tr>
                                    <td colspan="2">{#$event.brand_str#}</td>
                                </tr>
                                <tr>
                                    <td colspan="2" class="tt">{#$event.title#}</td>
                                </tr>
                                <tr>
                                <table width="100%" border="0" cellpadding="0">
                                    {#if !empty($event.event_date)#}
                                    <tr class="sep">
                                        <td class="label"><span>：</span>日期</td>
                                        <td>{#date('Y年m月d日',strtotime($event.event_date))#}</td>
                                    </tr>
                                    {#/if#}
                                    {#if !empty($event.event_time)#}
                                    <tr class="sep">
                                        <td class="label"><span>：</span>時間</td>
                                        <td>{#$event.event_time#}</td>
                                    </tr>
                                    {#/if#}
                                    {#if !empty($event.place)#}
                                    <tr class="sep">
                                        <td class="label"><span>：</span>地點</td>
                                        <td>{#$event.place#}</td>
                                    </tr>
                                    {#/if#}
                                    {#if !empty($event.intro)#}
                                    <tr class="sep">
                                        <td class="label"><span>：</span>簡介</td>
                                        <td>{#nl2br($event.intro)#}</td>
                                    </tr>
                                    {#/if#}
                                    <tr class="sep">
                                        <td class="td_red"><span>：</span>需要分數</td>
                                        <td ><span class="font_red">{#if !empty($event.points)#}{#$event.points#}{#else#}/{#/if#}</span><a href="{#optimize_url('help', 'show','page=4')#}" target="_blank"><i class="icon point"></i></a></td>
                                    </tr>
                                </table>
                                </tr>
                            </table>
                        </div>
                        {#if $event.status neq 2#}
                        <div class="infobox">
                            <span class="numbox">
                                <sup>名額</sup><span class="num">{#$event.quota#}</span>&nbsp;
                                <sup>申請人數</sup><span class="num">{#$event.apply_num#}</span>&nbsp;
                                <sup>人氣</sup><span class="num">{#$event.click#}</span>
                            </span><a style="cursor:pointer" {#if $event.is_begin eq 1#}onclick="apply({#$eid#})"{#else#}onclick="showpop('活動尚未開始！');"{#/if#} class="btn btn_join"><span>立即參加</span></a>


                            {#if time() < strtotime($event.starttime)#}
                            <div class="text_coming_info"><strong class="text_coming"></strong></div>
                            {#else if empty($event._difTime.0)#}
                            <div class="text_over_info"><strong class="text_over"></strong></div>
                            {#else#}
                            <div class="info"><span>尚餘</span><strong>{#$event._difTime.0#}</strong><sub>{#$dateArr[$event._difTime.1]#}</sub></div>
                            {#/if#}
                        </div>
                        {#/if#}
                    </div>
                </div>
            </div>
        </div>

        <!--step
        <div class="stepbox">
            <div class="steps"><span>step1 成為體驗大人/試用專員,step2 成為體驗大人/試step3 成為體驗大人/試用專員用專員,</span></div>
        </div>-->
        {#if !empty($userlist) && empty($event._difTime.0)#}
        <div class="hybox">
            <div class="tagbox clearfix">
                <div class="t2 t curr"><em class="hack">&nbsp;</em><span class="ir txt txt1">獲邀會員</span></div>
            </div>
            <div class="imgs">
                <div class="ul clearfix">
                    <div class="listw" id="intro_content" style="overflow:hidden;height:180px">

                        {#foreach from=$userlist item=v key=k#}
                        <span class="list">
                            <span class="infobox">
                                <span class="imgbox"><a href="{#optimize_url('person', 'report','username='|cat:$v.username)#}" ><img src="{#$v.photo_l#}" width=56 /></a></span><br>
                                <span class="intro">{#$v.username#}</span>
                            </span>
                        </span>
                        {#/foreach#}

                        <span class="list left_fix">&nbsp;</span>
                    </div>
                </div>
                <div class="bar" id="intros_scroll">

                </div>
            </div>
        </div>

        {#/if#}
        {#if !empty($reportlist)#}
        <div class="trbox b_box trbox_e">
            <div class="hd">
                <h2 class="ir ht"><span>活動申請 EVENT REGISTRATION</span></h2>
            </div>
            <div class="bd">

                {#foreach from=$reportlist item=v key=k#}
                <div class="iibox {#if ($k+1)%5==0#}last{#/if#}">
					<div class="imgbox"><p class="img_p"><a href="{#optimize_url('person', 'report','username='|cat:$v.username)#}"><span><img src='{#$v.photo_l#}' alt="pic"></span></a></p></div>
                    <div class="infobox">
                        <p>{#$v.username#}</p>
                        <p>年齡 : {#$v.age#}</p>
                        <p>臉部膚質 : {#$v.body_skin#}</p>
                        <p class="multi multi1">
                            <label class="lb">申請的原因 : </label>
                            <span>{#nl2br($v.body)#}</span>
                        </p>
                    </div>
                    <!--{#if $v.application_status==7 || $v.application_status==9#}<a class="passbtn" >通過</a>{#else#}<a class="processbtn">審核中</a>{#/if#}-->
                </div>
                {#/foreach#}
            </div>
        </div>
        {#$pagelist#}
        {#/if#}
    </div>
    <!-- main-->
    <div class="sidebar">
        {#show_block('b2',1,'','sidebar_ad')#}
        {#show_block('b1',2,'','sidebar_function')#}
        {#show_block('b3',0,'','sidebar_search')#}
        {#show_block('b13',0,'','sidebar_registation')#}
        {#show_block('b5',0,'','sidebar_top3 b_box')#}
        {#show_block('b6',0,'','sidebar_facebook')#}
    </div>
    <!-- sidebar -->

</div><!--body-->

<!--  遮罩層  -->
<div id="fullbg"></div>
<div  class="irpopbox popbox b_box" style="top:400px;z-index:60;display:none;" id="dialog">
    <div class="hd">
        <h2 class="ir ht" id=loginTextName><span id=loginText>iTRIAL 會員登入 REGISTRATION</span></h2>
        <a class="popclose" style="cursor:pointer" onclick="closeLB();">close</a>
    </div>
    <div class="bd">
        <div class="lbox">
            <p>會員名稱 USERNAME</p>
            <input type="text" class="ipt" name="email" id="email">
            <p class="tip" id="email_tip" style="display:none;">
                <em class="hack"></em>
                <a class="close" href="javascript:void(0);" onclick="$('#email_tip').hide();">close</a>
                {#php#}echo NO_USERNAME;{#/php#}
            </p>
            <p>密碼 PASSWORD</p>
            <input type="password" class="ipt" name="password" id="password">
            <p class="tip" id="password_tip" style="display:none;">
                <em class="hack"></em>
                <a class="close" href="javascript:void(0);" onclick="$('#password_tip').hide();"> close </a>
                {#php#}echo NO_PASSWORD;{#/php#}
            </p>
            <a class="btn_s btn_s_login" onclick="login()" style="cursor:pointer" id="login"><strong>login</strong></a>
            <ul>
                <li><a href="/member.php?action=forgetPassword">忘記密碼</a></li>
                <li><a href="/member.php?action=reg&toURL={#$thisUrl#}">註冊新帳號</a></li>
            </ul>
        </div>
        <div class="rbox">
            <div class="lgbox"><em class="hack"></em>
                <a class="fbtn ir" href="/member.php?action=login_facebook&toURL={#$thisUrl#}"><strong>以facebook登入</strong></a><span><a class="fb_link" href="/member.php?action=login_facebook&toURL={#$thisUrl#}">以facebook登入</a></span>
            </div>
            <div class="lgbox lgbox2" onClick="fnblogin()" id=login_type style="cursor:pointer" ><em class="hack"></em>
                <a class="fabtn ir" id=classlogo><strong>以F&amp;B登入</strong></a><span id=login_type_text  >以F&amp;B登入</span>
            </div>
        </div>
    </div>
</div>

<div style="top:400px;z-index:60;display:none;" class="apopbox popbox b_box" id="dialog_limits">
    <div class="hd">
        <h2 class="ir ht"><span>提示信息 ALERT</span></h2>
        <a class="popclose" onclick="closeLB();" style="cursor:pointer">close</a>            </div>
    <div class="bd">
        <p>你還未成為{#if $event.member_type==5#}體驗達人{#else#}試用專員{#/if#}，<a href="/member.php?action={#if $event.member_type==5#}regExpert{#else#}regTrial{#/if#}">立即申請</a>，享受更多待遇！</p>
        <a href="{#optimize_url('events', 'invite_list')#}" class="btn_b_more_fun btn_b"><strong>查看更多活動</strong></a>
    </div>
</div>

<div style="top:400px;z-index:60;display:none;" class="apopbox popbox b_box" id="dialog_popup">
    <div class="hd">
        <h2 class="ir ht"><span>提示信息 ALERT</span></h2>
        <a class="popclose" onclick="closeLB();" style="cursor:pointer">close</a>            </div>
    <div class="bd">
        <p id="popupText"></p>
        <a href="{#optimize_url('events', 'invite_list')#}" class="btn_b_more_fun btn_b"><strong>查看更多活動</strong></a>
    </div>
</div>

<script type="text/javascript">

    function ajax_fb_ponits(){
        $.ajax({
            url : '/ajax_points.php?action=ajax_fb_points',
            type : 'POST',
            data: "code={#php#}echo md5('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'imoreHK');{#/php#}&action_name=share_event_invite&remark={#str_replace("'","’",$event.title)#}",
            dataType : 'json',
            success: function(data){
                if(data.ret==0){
                    // console.info("未登入");
                }else if(data.ret==1){
                    if(data.data.ret==1){
                        // console.info(data.data.action);
                    }else{
                        //  console.info(data.data.reason);
                    }

                }else{
                    // console.info(data.reason);
                }
            }
        });

    }

    function postToFeed() {

        // calling the API ...
        var obj = {
            method: 'feed',
            //redirect_uri: '{#php#}echo DOMAIN;{#/php#}product.php?action=invite_inpage&mtype=1&pid={#$event.id#}',
            link: '{#php#}echo DOMAIN;{#/php#}event.php?action=invite_inpage&mtype={#$event.member_type#}&eid={#$event.id#}',
            picture: '{#php#}echo DOMAIN;{#/php#}{#$event._photo_url#}',
            name: '{#str_replace("'","’",$event.title)#}',
            caption: '{#str_replace("'","’",$event.brand_str)#}'
        };

        FB.ui(obj, function(response){
            if(response['post_id']){
                ajax_fb_ponits();
            }
        });
    }

    function apply(eid){
        $.getJSON("/event.php?action=ajax&t=1",{eid:eid},function(data){
            if(parseInt(data.login)==1){
                if(parseInt(data.email)==1){
                    if(parseInt(data.limit)==1){
                        if(parseInt(data.invite)==1){
                            window.location.href="{#optimize_url('events', 'submit_application','eid='|cat:$eid)#}";
                        }else{showpop(data.msg);}
                    }else{
                        showLB('dialog_limits',0);
                        $("#limitsText").text(data.msg);
                    }
                }else{
                    $("#popupText").html("您的電郵地址尚未驗證，請先激活！<a class='pink' href='/member.php?action=resendActivation' target='_blank'>重發激活郵件</a>");
                    showLB('dialog_popup',0);
                }
            }else{
                $("#loginText").text("以iMORE帳戶登入");
                $("#login").attr("onClick","login('apply("+eid+")')");
                $("#login_type").attr("onClick","fnblogin('apply("+eid+")')");
                showLB('dialog',0);
            }
        });
    }

    function login(func){


        var email = $('#email').val();
        if($.trim(email).length==0){
            $('#email_tip').show();
            $('#email').focus();
            return false;
        }
        var password = $('#password').val();
        if($.trim(password).length==0){
            $('#password_tip').show();
            $('#password').focus();
            return false;
        }
        /*
                var captcha = $('#captcha').val();
                if($.trim(captcha).length==0){
                        alert("{#$ERR_CAPTCHA#}");
                        $('#captcha').focus();
                        return false;
                }
         */
        $.getJSON("/member.php?action=ajax_login_imore",{email:email,password:password/*,captcha:captcha*/},function(data){
            if(parseInt(data.ret)==1){
                showpop(data.msg);
            }else if(parseInt(data.ret)==2){
                showpop(data.msg);
                //$('#captcha').attr("src","captcha.php?t="+Math.random());
            }else{closeLB();memberBar();eval(func);}
        });
    }

    function login_fnb(func){
        var email = $('#email').val();
        if($.trim(email).length==0){
            $('#email_tip').show();
            $('#email').focus();
            return false;
        }
        var password = $('#password').val();
        if($.trim(password).length==0){
            $('#password_tip').show();
            $('#password').focus();
            return false;
        }
        /*
                var captcha = $('#captcha').val();
                if($.trim(captcha).length==0){
                        alert("{#$ERR_CAPTCHA#}");
                        $('#captcha').focus();
                        return false;
                }
         */


        $.getJSON("/member.php?action=ajax_login_fnb",{email:email,password:password/*,captcha:captcha*/},function(data){
            if(parseInt(data.ret)==1){
                showpop(data.msg);
            }else if(parseInt(data.ret)==2){
                showpop(data.msg);
                //$('#captcha').attr("src","captcha.php?t="+Math.random());
            }else{closeLB();memberBar();eval(func);}
        });
    }

    function fnblogin(func){
        $("#loginText").text("以 F&B 帳戶登入");
        $("#login").attr("onClick","login_fnb("+func+")");
        $("#login_type_text").text("以 iMORE 登入");
        $("#login_type").attr("onClick","itriallogin("+func+")");
        $("#loginTextName").css("background-position","0 -940px");
        $("#classlogo").attr("class","itrial ir");

    }
    function itriallogin(func){
        $("#loginText").text("以 iMORE 帳戶登入");
        $("#login").attr("onClick","login("+func+")");
        $("#login_type_text").text("以 F&B 登入");
        $("#login_type").attr("onClick","fnblogin("+func+")");
        $("#loginTextName").css("background-position","0 -900px");
        $("#classlogo").attr("class","fabtn ir");
    }

    function showLB(ct,n){
        var sh=$(document).height();
        var sw=$(document).width();
        var ch=$(window).height();
        var cw=$(window).width();
        var st=$(window).scrollTop();
        var sl=$(window).scrollLeft();
        var objH=$("#"+ct).height();
        var objW=$("#"+ct).width();
        var tbT=(Number(st)+(Number(ch)-Number(objH))/3)+"px";
        var tbL=(Number(sl)+(Number(cw)-Number(objW))/2)+"px";
        if(n==0){
            $("#fullbg").css({width:sw,height:sh});
            $("#"+ct).css({top:tbT});
            $("#fullbg").fadeTo('slow', 0.4);
            $("#"+ct).fadeIn('slow');
            $(window).scroll(function(){showLB(ct,1)});
            $(window).resize(function(){showLB(ct,1)});
        }else{
            if($("#fullbg").css("display")=="block"){
                $("#fullbg").css({width:sw,height:sh});
                $("#"+ct).css({top:tbT});
            }
        }
    }

    function closeLB(){
        $("#fullbg").fadeOut('slow');
        $("#dialog").fadeOut('slow');
        $("#dialog_limits").fadeOut('slow');
        $("#dialog_popup").fadeOut('slow');

    }

    function showpop(text){
        $("#fullbg").fadeIn();
        $("#dialog").fadeOut('slow');
        $("#dialog_limits").fadeOut('slow');
        showLB('dialog_popup',0);
        $("#popupText").text(text);
    }

    $(document).ready(function(){

        $('#email').mousedown(check_register_email);
        $('#email').keyup(check_register_email);

        $('#password').mousedown(check_register_password);
        $('#password').keyup(check_register_password);

    });
    function check_register_email(){
        var rt = 0;
        if($('#email').val().length==0){
            $("#email_tip").addClass("tip").show();
        }else {
            $("#email_tip").removeClass("tip").hide();
            rt =  1;
        }
        return rt;
    }
    function check_register_password(){
        var rt = 0;
        if($('#email').val().length==0){
            $("#email_tip").addClass("tip").show();
        }else {
            $("#email_tip").removeClass("tip").hide();
            rt =  1;
        }
        return rt;
    }

    function check_cssby(tipmainname){

        var obj =$("#"+tipmainname+"_tip");
        if(obj.attr('class')!='tip'){
            return 1;
        }else{
            return 0;
        }
    }
    function check_register(){
        if($('#email').val().length==0){
            $('#email').focus();
            //alert("{#$NO_USERNAME#}");
            $('#email_tip').show();
            return false;
        }else if($('#password').val().length==0){
            $('#password').focus();
            //alert("{#$NO_PASSWORD#}");
            $('#password_tip').show();
            return false;
        }else{
            /*
                        var captcha=$('#captcha').val();
                        $.get("{#$selfurl#}?action=ajax_checkCaptcha",{captcha:captcha},function(data){
                                if(data=='false'){
                                        alert("{#$ERR_CAPTCHA#}");
                                        $('#captcha').focus();
                                        $('#captcha_img').attr("src","captcha.php?t="+Math.random());
                                        return false;
                                }else{
                                        $("#form1").submit();
                                }
                        });
             */
            $("#form1").submit();
        }
    }
    $(document).ready(function(){
        $('#email').focus();
    });
</script>
<script src="/js/jquery.event.drag.min.js"></script>

<script>
    var is_apple=0;
    setTimeout( function(){$("#intro_content").fadeIn('normal',function(){
            bindSilder("intro_content", "intros_scroll");
        });}, ( 300 ) );
</script>
{#include file="footer.php"#}